package com.base.weeks.week;

/**
 * @ClassName: AddSpaces
 * @Description: TODO
 * @author: li
 * @Date: 2021/12/19 10:42 上午
 */
public class AddSpaces {
    public String addSpaces(String s, int[] spaces) {
        StringBuilder builder = new StringBuilder();
        int j = 0,i=0;
        for(;i<s.length();i++){
            if(i==spaces[j]){
                builder.append(" ");
                j++;
            }
            builder.append(s.charAt(i));
        }
        builder.append(s.substring(i));
        return builder.toString();
    }
}
